﻿<div ng-controller="productController" class="row">
    <div class="col-md-2">
        &nbsp;
    </div>
    <!--Probando-->
    <div class="col-md-7">
        <form ng-submit="save()" id="formProducto">
            <div class="col-xs-3">
                <input type="text" ng-model="product.codigo" placeholder="Codigo" required class="form-control"/>
                <input type="text" ng-model="product.description" placeholder="Descripcion" class="form-control"/>
            </div>
            <div class="col-xs-3">
                <input type="number" ng-model="product.stock" placeholder="Stock" class="form-control" />
                <input type="text" ng-model="product.price" placeholder="Precio S/." class="form-control" />
            </div>
            <div class="col-xs-3">
                <input type="date" ng-model="product.fechaVenci" class="form-control" />
                <select ng-model="product.categoryId" ng-options="value.id as value.name for value in categoryList" class="form-control">
                    <option>---</option>
                </select><!--{{product.categoryId}}-->
            </div>
            <div class="col-xs-3" align="right">
                <button type="submit" class="btn btn-danger">Guardar</button>
            </div>
        </form>
        <br />       
        <!--Table-->
        <table class="table table-striped table-bordered table-hover" align="center">
            <thead>
                <tr>
                    <th colspan="6" align="center">
                        LISTADO DE PRODUCTOS
                    </th>
                </tr>
                <tr>
                    <th>CODIGO</th>
                    <th>DESCRIPCION</th>
                    <th>STOCK</th>
                    <th>PRECIO</th>
                    <th>CATEGORIA</th>
                    <th>OPCIONES</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="d in list | filter:name">
                    <td>{{d.codigo}}</td>
                    <td>{{d.description}}</td>
                    <td>{{d.stock}}</td>
                    <td>{{d.price}}</td>
                    <td>{{d.categoryModel.name}}</td>
                    <td align="center">
                        <a href="" ng-click="getById(d)"><span class="glyphicon glyphicon-pencil"></span></a>
                        <a href="" ng-click="delete(d)"><span class="glyphicon glyphicon-remove"></span></a>
                    </td>
                </tr>
            </tbody>
        </table>
        <!--Tabla-->   
    </div>
    <!--Probando-->

        &nbsp;
    </div>
</div>
